﻿<?php 
	include (dirname(__FILE__)."/../include/header.php"); 
	include (dirname(__FILE__)."/../include/zy_function3.php"); 
?>
 <style type="text/css">
<!--
a:link {
 text-decoration: none;
}
a:visited {
 text-decoration: none;
}
a:hover {
 text-decoration: none;
}
a:active {
 text-decoration: none;
}
-->
</style>
<?php
	$shop_id=$_REQUEST['shop_id'];
	$sql=mysql_query("select * from zy_shop where shop_id='".$shop_id."'");
	$shop=mysql_fetch_array($sql);
?>
<?php
$shop_id=$_REQUEST['shop_id'];
//组织生成分页
$sql="SELECT COUNT(a.food_review_id) num FROM zy_food_review a,zy_order b WHERE shop_id='".$shop_id."' AND a.order_id=b.ord_id".$where;
//当前页
$p=$_REQUEST['p'];
if(!$p>0){
	$p=1;
}
//每页记录条数
$pagesize=20;
$Page=page($p,$sql,'','',$pagesize);
mysql_query($sql);
$sql0=("SELECT a.*,b.food_name,b.price FROM zy_food_review a , zy_food b WHERE a.order_id IN ( SELECT ord_id FROM zy_order WHERE shop_id='".$shop_id."') AND a.food_id=b.food_id ORDER BY a.food_review_id DESC LIMIT ".($p-1)*$pagesize.",".$pagesize);
$result=mysql_query($sql0);
$n=1;	
?>
<div class="container">
<ul class="breadcrumb">
			<?php 
  	$shop_id=$_GET['shop_id'];
  // echo $shop_id;
  	 $sql2="select * from zy_shop where shop_id='".$shop_id."'";
  	 //echo $sql2;
  	 // echo $sql2;
  	$query2=mysql_query($sql2);
  	if($query2=mysql_fetch_array($query2)){
  	?>
  	 <?php 
  		$sql="SELECT a.id id1,a.name name1,b.id id2 ,b.name name2,c.`id` id3 ,c.`name` name3 FROM zy_businessarea a LEFT JOIN zy_businessarea b ON a.`id`=b.`parentId` LEFT JOIN zy_businessarea c ON b.`id`=c.`parentId` WHERE c.`id`=".$query2['district']."";
  		//echo $sql;
  		$query4=mysql_query($sql);
  		if($query4=mysql_fetch_array($query4)){?>
  			<li><a href="<?php echo SITE_ROOT ?>/index.php"><?php echo $query4['name1'] ?></a>><a href="<?php echo SITE_ROOT ?>/index.php?id1=<?php echo $query4['id2'];?>"><?php echo $query4['name2'] ?></a>><a href="<?php echo SITE_ROOT ?>/index.php?id2=<?php echo $query4['id3'];?>"><?php echo $query4['name3']?></a>><?php echo $query2['shop_name'];?></li>
     <?php } }?>
      </ul>
  <div class="row">
<div class="span12 right-fold bordered-box">
<div class="row">
<div class="span12">
 <div class="important-info alert warning"> <?php echo $shop['introduction'];?> </div>
</div>
<div class="span9 master-side restaurant-content">
  <div class="row">
    <div class="span9">
              <ul class="nav nav-tabs restaurant-tab">
                <li ><a href="<?php echo SITE_ROOT?>/index_shop.php?shop_id=<?php echo $shop_id;?>">菜单</a></li>
                <li class="active"><a href="<?php echo SITE_ROOT?>/shop/shop_evaluate.php?shop_id=<?php echo $shop_id;?>">评价</a></li>
                <li ><a href="<?php echo SITE_ROOT?>/shop/shop_message.php?shop_id=<?php echo $shop_id;?>">留言</a></li>
              </ul>
      <div class="restaurant-tab-content">
        <div class="ratings">
          <table id="rst_dianping_table" class="dianping_table mr10" style="text-align:center;">
            <thead>
              <tr>
                <th class="rating">评价</th>
                <th class="shijian">时间</th>
                <th class="user">食客</th>
                <th class="food">美食</th>
              </tr>
            </thead>
            <tbody>
			<?php while($rs1=mysql_fetch_array($result)){
			?>
              <tr>
                <td class="rating">
				<span class="rating-star r<?php echo $rs1['food_score']*2;?>"></span>
				
				</td>
                <td class="dianping">
				<?php
				  $sql3=mysql_query("select * from zy_order where ord_id='".$rs1['order_id']."'");
				   while($ord=mysql_fetch_array($sql3)){
				?>
                  <?php echo $ord['order_time'];?>
				  </td><?php }?>
                <td class="user"> 
				<?php
					$sql4=mysql_query("select * from zy_order where ord_id='".$rs1['order_id']."'");
				   while($ord1=mysql_fetch_array($sql4)){
				   	$sql5=mysql_query("select * from zy_user where user_id='".$ord1['user_id']."'");
				   while($user=mysql_fetch_array($sql5)){
				?>
				<?php echo $user['username'];?>
				</td>
				 <?php }}?>
                <td class="food">
					<?php echo $rs1['food_name'];?>
				  <br/>
                <span class="price">
				<?php echo $rs1['price'];?>元</span>
				</td>
              </tr><?php }?>
            </tbody>
          </table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" class="border">
	<tr>
		<td height="30" align="center" bgcolor="#FFFFFF"> 
		<div class="pagination">
		<ul>
		<li>
		<?php if($Page['currentPage']>1){?>
 <?php if($Page['currentPage']!=1){?>
       <a href="<?php echo SITE_ROOT?>/shop/shop_evaluate.php?shop_id=<?php echo $shop_id;?>">首页</a> 
	   <a href="<?php echo SITE_ROOT?>/shop/shop_evaluate.php?shop_id=<?php echo $shop_id;?>&p=<?php echo $Page['currentPage']-1;?>&p=<?php echo $Page['currentPage']-1;?>">上一页</a>
       <?php } for ($i=$Page['begin'];$i<=$Page['end'];$i++){?>
       <a href="<?php echo SITE_ROOT?>/shop/shop_evaluate.php?shop_id=<?php echo $shop_id;?>&p=<?php echo $i;?>;" <?php echo $i==$Page['currentPage'] ? "style='text-decoration: underline;font-weight: bold;'":''?> ><?php echo $i;?></a>
       <?php }if($Page['currentPage']!= $Page['totalPages']){?>
       <a href="<?php echo SITE_ROOT?>/shop/shop_evaluate.php?shop_id=<?php echo $shop_id;?>&p=<?php echo $Page['currentPage']+1;?>;">下一页</a> 
	   <a href="<?php echo SITE_ROOT?>/shop/shop_evaluate.php?shop_id=<?php echo $shop_id;?>&p=<?php echo $Page['totalPages'];?>">尾页</a></td>
        <?php }	}?>
	   		</li>
		</ul>
</div>
		</td>
	</tr>
</table>
        </div>
      </div>
    </div>
  </div>
</div>
<?php include (dirname(__FILE__)."/../include/index_shop_right.php"); ?>
      </div>
    </div>
<?php include (dirname(__FILE__)."/../include/footer.php"); ?>
